class ViewbookbycategoryController < ApplicationController
  def new
    @user = current_user
    @categories = Category.all
    @cat_id = params[:cat_id].to_i
    @cat = Category.where("id = :id",{:id=>@cat_id}).first
    @books = Kaminari.paginate_array(Book.where("category_id = :cat",{:cat=>@cat_id})).page(params[:page]).per(3)
  end
end
